/**
 * 
 */
package it.fuesi.myseries.api;

import it.fuesi.myseries.model.MySeriesConstant;

import java.util.Observable;
import java.util.Observer;

import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

/**
 * @author fuesi
 *
 */
public class ApiBrokerServiceHandler extends Handler {

	
	private Observer observer;
	
	public ApiBrokerServiceHandler(Observer observer){
		this.observer = observer;
	}
	
	public ApiBrokerServiceHandler(Context observer){
		this.observer = (Observer)observer;
	}
	
	@Override
	public void handleMessage(Message msg) {
		final Bundle bundle = msg.getData();
		
		System.out.println("handleMessage");
		
		final Bundle results = bundle.getBundle(MySeriesConstant.RESULTS.toString());
		
		observer.update(new Observable(), results);
		
	}
	
}
